package com.bmf.module.rbac.controller;

import com.bmf.module.rbac.service.RbacMenuRoleService;
import com.bmf.module.rbac.vo.RbacMenuRoleUpdateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.bmf.core.result.R;

/**
 * (RbacMenuRole)表控制层
 *
 * @author makejava
 * @since 2022-12-27 15:33:14
 */
@RestController
@RequestMapping("rbacMenuRole")
@Api(tags = {"角色菜单接口"})
public class RbacMenuRoleController{
    /**
     * 服务对象
     */
    @Autowired
    private RbacMenuRoleService rbacMenuRoleService;

//    /**
//     * 查询所有数据
//     *
//     * @param roleid 角色id
//     * @return 所有数据
//     */
//    @GetMapping("/{roleid}")
//    @ApiOperation(value = "根据角色id查询菜单")
//    public R<List<RbacMenuResultVo>> selectByRoleId(@PathVariable("roleid") Integer roleid) {
//        return R.success(rbacMenuRoleService.selectByRoleId(roleid));
//    }

    /**
     * 查询所有菜单id
     * @return
     */
    @GetMapping("selectAll/{roleid}")
    @ApiOperation(value = "根据角色id查询菜单")
    public R<List<Integer>> selectAll(@PathVariable("roleid") Integer roleid){
        return R.success(rbacMenuRoleService.selectAll(roleid));
    }


    /**
     * 新增数据
     *
     * @param rbacMenuRoleUpdateVo 实体对象
     * @return 新增结果
     */
    @PostMapping
    @ApiOperation(value = "新增数据")
    public R<Void> insert(@RequestBody RbacMenuRoleUpdateVo rbacMenuRoleUpdateVo) {
        rbacMenuRoleService.insert(rbacMenuRoleUpdateVo);
        return R.ok();
    }



}

